package com.millstein.eduservice.controller.front;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.millstein.commonutils.Result;
import com.millstein.eduservice.entity.EduTeacher;
import com.millstein.eduservice.service.EduTeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("eduservice/teacherfront")
@CrossOrigin
public class TeacherFrontController {

    @Autowired
    private EduTeacherService eduTeacherService;

    /**
     * 分页查询讲师列表
     * @param page
     * @param limit
     * @return
     */
    @PostMapping("getTeacherFrontList/{page}/{limit}")
    public Result getTeacherFrontList(@PathVariable("page") Integer page, @PathVariable("limit") Integer limit) {
        Page<EduTeacher> pageInfo = new Page<>(page, limit);
        Map<String, Object> map = eduTeacherService.getTeacherFrontList(pageInfo);
        return Result.ok().data(map);
    }
}
